﻿<Controls:SinacorWindow x:Class="Sinacor.UI.Bovespa.Ordens.View.SmartClient.DistribuicaoOrdemLote"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	Title="{DynamicResource Bovespa.Ordens.Label.DistribuicaoOrdemLote}"	
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Local="clr-namespace:Sinacor.UI.Bovespa.Ordens.View.SmartClient"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    ModuleId="ORD"
    ModulePlus="true"    
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"                     
    StateChanged="SinacorWindow_StateChanged"
    Closed="SinacorWindow_Closed"
    Deactivated="SinacorWindow_StateChanged"
>

    <!-- RESOURCES -->
    <Controls:SinacorWindow.Resources>
        <Grid VerticalAlignment="Top" Width="94" Height="208" HorizontalAlignment="Left" x:Key="lotesPopUpTemplate">
            <Controls:SinacorListBox ScrollViewer.VerticalScrollBarVisibility="Visible" 
                 x:Name="listBoxTrocarOrdens" 
                 Margin="4,4,0,0" 
                 Width="90"  Height="200"
                 HorizontalAlignment="Center"                                                      
                 VerticalAlignment="Top" 
                 ItemsSource="{Binding LoteVinculadoContextMenuModelCollection}"
                 SelectionMode="Single"
                 MouseDoubleClick="lotesListBox_MouseDoubleClick"
            >
                <Controls:SinacorListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type Controls:SinacorListBoxItem}">
                        <Setter Property="Content" Value="{Binding Path=NomeLote}"/>
                    </Style>
                </Controls:SinacorListBox.ItemContainerStyle>
            </Controls:SinacorListBox>
        </Grid>

        <Grid VerticalAlignment="Top" Width="94" Height="208" HorizontalAlignment="Left" x:Key="lotesPopUpTodasTemplate">
            <Controls:SinacorListBox ScrollViewer.VerticalScrollBarVisibility="Visible" 
                 x:Name="listBoxTrocarOrdensTodas" 
                 Margin="4,4,0,0" 
                 Width="90"  Height="200"
                 HorizontalAlignment="Center"                                                      
                 VerticalAlignment="Top" 
                 ItemsSource="{Binding LoteVinculadoContextMenuModelCollection}"
                 SelectionMode="Single"
                 MouseDoubleClick="lotesListBox_MouseDoubleClick"
            >
                <Controls:SinacorListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type Controls:SinacorListBoxItem}">
                        <Setter Property="Content" Value="{Binding Path=NomeLote}"/>
                    </Style>
                </Controls:SinacorListBox.ItemContainerStyle>
            </Controls:SinacorListBox>
        </Grid>

        <Grid VerticalAlignment="Top" Width="94" Height="208" HorizontalAlignment="Left" x:Key="lotesPopUpDiscricionariasTemplate">
            <Controls:SinacorListBox ScrollViewer.VerticalScrollBarVisibility="Visible" 
                 x:Name="listBoxTrocarOrdensDiscricionarias" 
                 Margin="4,4,0,0" 
                 Width="90"  Height="200"
                 HorizontalAlignment="Center"                                                      
                 VerticalAlignment="Top" 
                 ItemsSource="{Binding LoteVinculadoContextMenuModelCollection}"
                 SelectionMode="Single"
                 MouseDoubleClick="lotesListBox_MouseDoubleClick"
            >
                <Controls:SinacorListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type Controls:SinacorListBoxItem}">
                        <Setter Property="Content" Value="{Binding Path=NomeLote}"/>
                    </Style>
                </Controls:SinacorListBox.ItemContainerStyle>
            </Controls:SinacorListBox>
        </Grid>

        <Grid VerticalAlignment="Top" Width="94" Height="208" HorizontalAlignment="Left" x:Key="lotesPopUpNaoDiscricionariasTemplate">
            <Controls:SinacorListBox ScrollViewer.VerticalScrollBarVisibility="Visible" 
                 x:Name="listBoxTrocarOrdensNaoDiscricionarias" 
                 Margin="4,4,0,0" 
                 Width="90"  Height="200"
                 HorizontalAlignment="Center"                                                      
                 VerticalAlignment="Top" 
                 ItemsSource="{Binding LoteVinculadoContextMenuModelCollection}"
                 SelectionMode="Single"
                 MouseDoubleClick="lotesListBox_MouseDoubleClick"
            >
                <Controls:SinacorListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type Controls:SinacorListBoxItem}">
                        <Setter Property="Content" Value="{Binding Path=NomeLote}"/>
                    </Style>
                </Controls:SinacorListBox.ItemContainerStyle>
            </Controls:SinacorListBox>
        </Grid>
    </Controls:SinacorWindow.Resources>
    <!-- RESOURCES -->

    <Grid x:Name="LayoutRoot">
        <Controls:SinacorExpanderContainer x:Name="distribuicaoOrdensLotesExpanderContainer">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- GRID PESQUISA -->
            <Controls:SinacorExpander 
                x:Name="criteriosPesquisaExpander" 
                Grid.Row="0"                               
                Header="{DynamicResource Bovespa.Ordens.Label.Pesquisa}" IsExpanded="True">
                <Grid>
                    <Controls:SinacorLabel 
                        Margin="0,0,0,0"
                        Width="38"
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Top" 
                        Content="{DynamicResource Bovespa.Ordens.Label.Data}" 
                    />

                    <Controls:SinacorComboBox 
                        x:Name="cmbData"
                        Margin="42,0,0,0"             
                        HorizontalAlignment="Left" VerticalAlignment="Top"
                        IsSynchronizedWithCurrentItem="True"
                        ItemsSource="{Binding CalendarioModelCollection}"
                        DisplayMemberPath="DataPregaoShortDateString"
                        SelectedValuePath="DataPregao"
                        SelectedValue="{Binding OrdemDistribuicaoModel.DataPregao}"
                        DropDownClosed="cmbData_DropDownClosed"
                        SelectionChanged="cmbData_SelectionChanged" TabIndex="1"
                    />



                    <Controls:SinacorLabel 
                        Margin="142,0,0,0" Width="50"
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Top" Content="{DynamicResource Bovespa.Ordens.Label.Ativo}" 
                    />

                    <Controls:SinacorTextBox 
                        x:Name="txtAtivo"
                        CharacterCasing="Upper"
                        Margin="196,0,0,0" 
                        Width="90" 
                        HorizontalAlignment="Left" VerticalAlignment="Top"
                        Text="{Binding OrdemDistribuicaoModel.Titulo}" 
                        MaxLength="12"
                        LostFocus="txtAtivo_LostFocus" TabIndex="2"                        
                    />

                    <Controls:SinacorButton 
                        x:Name="btnConsultarAtivo" 
                        Margin="290,0,0,0"                                                 
                        VerticalAlignment="Top" HorizontalAlignment="Left"
                                                 
                        Icon="IconButtonSearch" 
                        ToolTip="{DynamicResource Bovespa.Ordens.Tooltip.PesquisarAtivo}"
                        Click="btnConsultarAtivo_Click" TabIndex="3"
                    />

                    <Controls:SinacorLabel 
                        Margin="317,0,0,0" 
                        Width="60"
                        VerticalAlignment="Top"                         
                        Content="{DynamicResource Bovespa.Ordens.Label.ApelidoCliente}" 
                        HorizontalAlignment="Left" 
                    />

                    <Controls:SinacorTextBox 
                        x:Name="txtCliente"
                        VerticalAlignment="Top" HorizontalAlignment="Left"
                        Margin="381,0,0,0"                         
                        Width="128" 
                        Text="{Binding OrdemDistribuicaoModel.ApelidoCliente}" 
                        MaxLength="18" TabIndex="4"
                    />

                    <Controls:SinacorButton 
                        x:Name="btnConsultarCliente" 
                        Margin="513,0,0,0"                                                 
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Top"                         
                        Icon="IconButtonClient"                         
                        ToolTip="{DynamicResource Bovespa.Ordens.Tooltip.PesquisarCliente}"                         
                        Click="btnConsultarCliente_Click" TabIndex="5"
                    />

                    <Controls:SinacorButton 
                        x:Name="btnPesquisar" 
                        Margin="596,52,0,0" 
                        Width="102" 
                        HorizontalAlignment="Left"                         
                        VerticalAlignment="Top" 
                        Content="{DynamicResource Bovespa.Ordens.Label.Pesquisar}"
                        IsDefault="True"
                        Click="btnPesquisar_Click"  TabIndex="11"
                    />

                    <Controls:SinacorGroupBox VerticalAlignment="Top" Header="{DynamicResource Bovespa.Ordens.Label.AgruparPor}" Width="592" HorizontalAlignment="Left" Margin="0,23,0,0" Height="49">
                        <Grid Margin="0,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Controls:SinacorRadioButton Grid.Column="0" x:Name="rdbPadrao" Width="90" Content="{DynamicResource Bovespa.Ordens.Label.Padrao}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4,0,0,0" IsChecked="True" Click="grupo_Click" TabIndex="6"/>
                            <Controls:SinacorRadioButton Grid.Column="1" x:Name="rdbOperador" Width="90" Content="{DynamicResource Bovespa.Ordens.Label.Operador}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4,0,0,0" IsChecked="False" Click="grupo_Click" TabIndex="7"/>
                            <Controls:SinacorRadioButton Grid.Column="2" x:Name="rdbOrdem" Width="90" Content="{DynamicResource Bovespa.Ordens.Label.Ordens}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4,0,0,0" IsChecked="False" Click="grupo_Click" TabIndex="8"/>
                            <Controls:SinacorRadioButton Grid.Column="3" x:Name="rdbAdmConc" Width="170" Content="{DynamicResource Bovespa.Ordens.Label.AdministradoConcorrente}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4,0,0,0" IsChecked="False" Click="grupo_Click" TabIndex="9"/>
                            <Controls:SinacorRadioButton Grid.Column="4" x:Name="rdbOpPOP" Width="116" Content="{DynamicResource Bovespa.Ordens.Label.OperacoesPOP}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4,0,0,0" IsChecked="False" Click="grupo_Click" TabIndex="10"/>
                        </Grid>
                    </Controls:SinacorGroupBox>

                </Grid>
            </Controls:SinacorExpander>
            <!-- GRID PESQUISA FINAL -->
            

            <!-- SEGUNDA GRID -->
            <Controls:SinacorExpander 
                x:Name="opcoesPesquisaLotesExpander" 
                Grid.Row="1"              
                Header="{DynamicResource Bovespa.Ordens.Label.Resultado}"
                Margin="0,4,0,0" IsExpanded="True" AllowExpand="False"                 
            >
                <!-- Definição do espaço a ser ocupado pela grid interna e pela legenda -->
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                <!-- Definição do espaço a ser ocupado pela grid interna e pela legenda -->

                    
                    <!-- TABS -->
                    <Controls:SinacorTabControl x:Name="tabGrupoLotes" IsSynchronizedWithCurrentItem="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Grid.Row="0">
                        
                        <!-- TAB 1-->
                        <Controls:SinacorTabItem x:Name="tabDiscricionarias" Header="{DynamicResource Bovespa.Ordens.Label.Discricionarias}" TabIndex="12">
                            <Controls:SinacorExpanderContainer x:Name="distribuicaoOrdensLotesExpanderContainer2">
                                
                                <!-- Definição da altura que vai separar os dois expanders na 1a tab -->
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="2*"/>
                                    <RowDefinition Height="1*"/>
                                </Grid.RowDefinitions>

                                <Controls:SinacorExpander 
            						x:Name="lotesExpander"                
            						Header="{DynamicResource Bovespa.Ordens.Label.Lotes}"
									Grid.Row="0" Grid.Column="0" IsExpanded="True" Margin="0,-2,0,0"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="25"/>
                                        </Grid.RowDefinitions>
                                        <Controls:SinacorDataGrid 
            								x:Name="lotesDataGridDiscricionarias" Grid.Row="0"
            								ItemsSource="{Binding Path=LotesDiscricionariasModelCollection}"
                                            ConfirmSelection="lotesDataGrid_ConfirmSelection"
            								SelectionChanged="lotesDataGrid_SelectionChanged"
            								BufferedSelectionChanged="lotesDataGrid_BufferedSelectionChanged"                        
            								ApplyingStyle="lotesDataGridDiscricionarias_ApplyingStyle" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate>
                                                    <StackPanel >
                                                        <!--<Controls:SinacorContextMenuItem x:Name="ctxMnuDistribuir" Header="{DynamicResource Bovespa.Ordens.Label.Distribuir}" Click="ctxMnuDistribuir_Click" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}, Path=ModulePlusLicense}" />-->
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuDistribuir" Header="{DynamicResource Bovespa.Ordens.Label.Distribuir}" Click="ctxMnuDistribuir_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.DistribuicaoValida, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuCancelar" Header="{DynamicResource Bovespa.Ordens.Label.MenuContextoCancelmentoDistribuicao}" Click="ctxMnuCancelar_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.CancelamentoValido, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>

                                                <Controls:Column Name="ApelidoCliente"
            										DisplayMemberPath="ApelidoCliente"
            										Title="Bovespa.Ordens.Label.Cliente"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
            										DisplayMemberPath="Titulo"
            										Title="Bovespa.Ordens.Label.Ativo"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="NaturezaOperacao"
            										DisplayMemberPath="NaturezaOperacao"
            										Title="Bovespa.Ordens.Label.NaturezaOperacao"
            										MaxLength="1"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
            										DisplayMemberPath="NumeroOrdem"
            										Title="Bovespa.Ordens.Label.NumeroNegocio"
            										MaxLength="9"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"           
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="LoginOperador"
            										DisplayMemberPath="LoginOperador"
            										Title="Bovespa.Ordens.Label.Operador"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"  
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
            										DisplayMemberPath="Quantidade"
            										Title="Bovespa.Ordens.Label.Quantidade"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
            										DisplayMemberPath="QuantidadeCasada"
            										Title="Bovespa.Ordens.Label.QuantidadeCasada"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n4" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="NumeroConjunto"
            										DisplayMemberPath="NumeroConjunto"
            										Title="Bovespa.Ordens.Label.NumeroConjunto"
            										MaxLength="9"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeDigitada"
            										DisplayMemberPath="QuantidadeDigitada"
            										Title="Bovespa.Ordens.Label.QuantidadeDigitada"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n4"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PercentualDigitado"
            										DisplayMemberPath="PercentualDigitado"
            										Title="Bovespa.Ordens.Label.PercentualDigitado"
            										MaxLength="6"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n2"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrazoTermo"
            										DisplayMemberPath="PrazoTermo"
            										Title="Bovespa.Ordens.Label.PrazoTermo"
            										MaxLength="6"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Discricionaria"
            										DisplayMemberPath="Discricionaria"
            										Title="Bovespa.Ordens.Label.Discricionaria"
            										MaxLength="1"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="Bolsa"
            										DisplayMemberPath="Bolsa"
            										Title="Bovespa.Ordens.Label.Bolsa"
            										MaxLength="2"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Center" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>

                                        <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Left" Margin="0,4,0,0">
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Clientes.Label.Legenda}" x:Name="txtLegendaInformar" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.NaoDistribuida}" x:Name="txtTrocarDepois" Width="96" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness04}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Parcialmente}" x:Name="txtPosicaoComCustodia" Width="142" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness02}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Totalmente}" x:Name="txtPosicaoExCustodia" Width="71" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                        </StackPanel>
                                    </Grid>
                                </Controls:SinacorExpander>


                                <Controls:SinacorExpander 
            						x:Name="ordensExpanderDiscricionarias" 
            						Header="{DynamicResource Bovespa.Ordens.Label.Ordens}"
									Grid.Row="1" Margin="0,4,0,0" IsExpanded="True"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <!---725-->
                                            <ColumnDefinition Width="250" />
                                            <!---240-->
                                        </Grid.ColumnDefinitions>

                                        <Controls:SinacorExpanderContainer Grid.Column="0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition	Height="*"/>
                                                <RowDefinition	Height="Auto"/>
                                            </Grid.RowDefinitions>

                                            <Controls:SinacorDataGrid  
            								x:Name="ordensDiscricionariasDataGrid"  Grid.Row="0" Grid.Column="0"
            								ItemsSource="{Binding Path=OrdensDiscricionariasModelCollection}"                                
            								SelectionChanged="ordensDataGrid_SelectionChanged"
            								ApplyingStyle="ordensDataGrid_ApplyingStyle"
                                            Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate x:Name="menuDataTemplate">
                                                    <StackPanel>

                                                        <Controls:SinacorContextMenuItem 
            												x:Name="trocarLoteMenuItemDiscricionarias" 
            												IsEnabled="False"
            												Header="{DynamicResource Bovespa.Ordens.Label.TrocarLote}" 
            												Click="trocarLoteMenuItem_Click"
            												Loaded="trocarLoteMenuItem_Loaded"
            												IsVisibleChanged="trocarLoteMenuItem_IsVisibleChanged" />

                                                        <Controls:SinacorContextMenuItem 
            												x:Name="criarLoteMenuItem" 
            												Header="{DynamicResource Bovespa.Ordens.Label.CriarNovoLote}"
            												Click="criarLoteMenuItem_Click"
            												Loaded="criarLoteMenuItem_Loaded"
            												IsVisibleChanged="criarLoteMenuItem_IsVisibleChanged" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="Data"
            										DisplayMemberPath="DataOrdem"
            										Title="Bovespa.Ordens.Label.Data"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="LoginOperador"
            										DisplayMemberPath="LoginOperador"
            										Title="Bovespa.Ordens.Label.Operador"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
            										DisplayMemberPath="NumeroOrdem"
            										Title="Bovespa.Ordens.Label.NumeroNegocio"
            										MaxLength="9"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Subsequencia"
            										DisplayMemberPath="NumeroOrdemSequencia"
            										Title="Bovespa.Ordens.Label.Subsequencia"
            										MaxLength="5"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Cliente"
            										DisplayMemberPath="ApelidoCliente"
            										Title="Bovespa.Ordens.Label.Cliente"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Broker"
            										DisplayMemberPath="ApelidoBroker"
            										Title="Bovespa.Ordens.Label.Broker"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
            										DisplayMemberPath="Titulo"
            										Title="Bovespa.Ordens.Label.Ativo"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
            										DisplayMemberPath="Quantidade"
            										Title="Bovespa.Ordens.Label.Quantidade"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
            										DisplayMemberPath="QuantidadeCasada"
            										Title="Bovespa.Ordens.Label.QuantidadeCasada"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>

                                        <Grid HorizontalAlignment="Left" 
									 		  VerticalAlignment="Top" 
                                              Name="lblMensagem1"
											  Grid.Row="1" 
											  Margin="0,4,0,0" 
											  Visibility="Collapsed">
                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" 
													 StrokeThickness="0" 
													 Width="15" 
													 Margin="0,4,0,0" 
													 HorizontalAlignment="Left" 
													 VerticalAlignment="Top" 
													 Height="15"/>
                                            <Controls:SinacorLabel HorizontalAlignment="Left" 
																   Content="{DynamicResource Bovespa.Ordens.Label.OrdensNaoCasadasNaoCompoem}" 
																   Margin="19,0,0,0" 
																   HorizontalContentAlignment="Left" 
																   Width="415"/>
                                        </Grid>

                                        </Controls:SinacorExpanderContainer>

                                        <Controls:SinacorDataGrid x:Name="precoMedioDiscricionariasDataGrid" 
            								ItemsSource="{Binding Path=PrecoMedioDiscricionariasModelCollection}" 
            								Grid.Row="0" Grid.Column="1" Margin="0,0,0,0"
                                            Height="Auto" Width="240" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="NomeLote"
            										Width="90"                                             
            										DisplayMemberPath="NomeLote"
            										Title="Bovespa.Ordens.Label.NomeLote"
            										MaxLength="60"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="PrecoMedio"
            										Width="90"                                             
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>
                                    </Grid>
                                </Controls:SinacorExpander>
                            </Controls:SinacorExpanderContainer>
                        </Controls:SinacorTabItem>
                        <!-- TAB 1-->
                        
                        <!-- TAB 2-->
                        <Controls:SinacorTabItem  x:Name="tabNaoDiscricionarias"  Header="{DynamicResource Bovespa.Ordens.Label.NaoDiscricionarias}" TabIndex="13">
                            <Controls:SinacorExpanderContainer x:Name="distribuicaoOrdensLotesExpanderContainer3">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="2*"/>
                                    <RowDefinition Height="1*"/>
                                </Grid.RowDefinitions>

                                <Controls:SinacorExpander 
            						x:Name="lotesExpander1"                
            						Header="{DynamicResource Bovespa.Ordens.Label.Lotes}"
            						Grid.Row="0" Grid.Column="0" IsExpanded="True" Margin="0,-2,0,0"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>

                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="25"/>
                                        </Grid.RowDefinitions>
                                        <Controls:SinacorDataGrid 
            								x:Name="lotesDataGridNaoDiscricionarias" Grid.Row="0"
            								ItemsSource="{Binding Path=LotesNaoDiscricionariasModelCollection}"
            								ConfirmSelection="lotesDataGrid_ConfirmSelection"
            								SelectionChanged="lotesDataGrid_SelectionChanged"
            								BufferedSelectionChanged="lotesDataGrid_BufferedSelectionChanged"
            								ApplyingStyle="lotesDataGridNaoDiscricionarias_ApplyingStyle"
                                            Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            >

                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate>
                                                    <StackPanel >
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuDistribuir" Header="{DynamicResource Bovespa.Ordens.Label.Distribuir}" Click="ctxMnuDistribuir_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.DistribuicaoValida, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuCancelar" Header="{DynamicResource Bovespa.Ordens.Label.MenuContextoCancelmentoDistribuicao}" Click="ctxMnuCancelar_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.CancelamentoValido, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>

                                                <Controls:Column Name="ApelidoCliente"
		                                            DisplayMemberPath="ApelidoCliente"
		                                            Title="Bovespa.Ordens.Label.Cliente"
		                                            MaxLength="18"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
		                                            DisplayMemberPath="Titulo"
		                                            Title="Bovespa.Ordens.Label.Ativo"
		                                            MaxLength="12"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="NaturezaOperacao"
		                                            DisplayMemberPath="NaturezaOperacao"
		                                            Title="Bovespa.Ordens.Label.NaturezaOperacao"
		                                            MaxLength="1"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
		                                            DisplayMemberPath="NumeroOrdem"
		                                            Title="Bovespa.Ordens.Label.NumeroNegocio"
		                                            MaxLength="9"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"           
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="LoginOperador"
		                                            DisplayMemberPath="LoginOperador"
		                                            Title="Bovespa.Ordens.Label.Operador"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"  
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
		                                            DisplayMemberPath="Quantidade"
		                                            Title="Bovespa.Ordens.Label.Quantidade"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            StringFormat="n4"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
		                                            DisplayMemberPath="QuantidadeCasada"
		                                            Title="Bovespa.Ordens.Label.QuantidadeCasada"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n4" 
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
		                                            DisplayMemberPath="PrecoMedio"
		                                            Title="Bovespa.Ordens.Label.PrecoMedio"
		                                            MaxLength="18"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n6"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="NumeroConjunto"
		                                            DisplayMemberPath="NumeroConjunto"
		                                            Title="Bovespa.Ordens.Label.NumeroConjunto"
		                                            MaxLength="9"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeDigitada"
		                                            DisplayMemberPath="QuantidadeDigitada"
		                                            Title="Bovespa.Ordens.Label.QuantidadeDigitada"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n4"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PercentualDigitado"
		                                            DisplayMemberPath="PercentualDigitado"
		                                            Title="Bovespa.Ordens.Label.PercentualDigitado"
		                                            MaxLength="6"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n2"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrazoTermo"
		                                            DisplayMemberPath="PrazoTermo"
		                                            Title="Bovespa.Ordens.Label.PrazoTermo"
		                                            MaxLength="6"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Discricionaria"
		                                            DisplayMemberPath="Discricionaria"
		                                            Title="Bovespa.Ordens.Label.Discricionaria"
		                                            MaxLength="1"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="Bolsa"
		                                            DisplayMemberPath="Bolsa"
		                                            Title="Bovespa.Ordens.Label.Bolsa"
		                                            MaxLength="2"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Center" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>


                                        <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Left" Margin="0,4,0,0">
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Clientes.Label.Legenda}" x:Name="txtLegendaInformar1" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.NaoDistribuida}" x:Name="txtTrocarDepois1" Width="96" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness04}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Parcialmente}" x:Name="txtPosicaoComCustodia1" Width="142" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness02}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Totalmente}" x:Name="txtPosicaoExCustodia1" Width="71" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                        </StackPanel>
                                    </Grid>
                                </Controls:SinacorExpander>


                                <Controls:SinacorExpander 
            						x:Name="ordensExpanderNaoDiscricionarias" 
            						Header="{DynamicResource Bovespa.Ordens.Label.Ordens}"
            						Grid.Row="1" Grid.Column="0" Margin="0,4,0,0" IsExpanded="True"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"  />
                                            <!---725-->
                                            <ColumnDefinition Width="250"  />
                                            <!---240-->
                                        </Grid.ColumnDefinitions>
                                        
                                        <Controls:SinacorExpanderContainer Grid.Column="0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition	Height="*"/>
                                                <RowDefinition	Height="Auto"/>
                                            </Grid.RowDefinitions>

                                        <Controls:SinacorDataGrid  
            								x:Name="ordensNaoDiscricionariasDataGrid"  Grid.Row="0" Grid.Column="0"
            								ItemsSource="{Binding Path=OrdensNaoDiscricionariasModelCollection}"                                
            								SelectionChanged="ordensDataGrid_SelectionChanged"
            								ApplyingStyle="ordensDataGrid_ApplyingStyle"
                                            Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate x:Name="menuDataTemplate1">
                                                    <StackPanel>
                                                        <Controls:SinacorContextMenuItem 
            												x:Name="trocarLoteMenuItemNaoDiscricionarias" 
            												IsEnabled="False"
            												Header="{DynamicResource Bovespa.Ordens.Label.TrocarLote}" 
            												Click="trocarLoteMenuItem_Click"
            												Loaded="trocarLoteMenuItem_Loaded"
            												IsVisibleChanged="trocarLoteMenuItem_IsVisibleChanged" />
                                                        <Controls:SinacorContextMenuItem 
            												x:Name="criarLoteMenuItem" 
            												Header="{DynamicResource Bovespa.Ordens.Label.CriarNovoLote}"
            												Click="criarLoteMenuItem_Click"
            												Loaded="criarLoteMenuItem_Loaded"
            												IsVisibleChanged="criarLoteMenuItem_IsVisibleChanged" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="Data"
            										DisplayMemberPath="DataOrdem"
            										Title="Bovespa.Ordens.Label.Data"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="LoginOperador"
            										DisplayMemberPath="LoginOperador"
            										Title="Bovespa.Ordens.Label.Operador"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
            										DisplayMemberPath="NumeroOrdem"
            										Title="Bovespa.Ordens.Label.NumeroNegocio"
            										MaxLength="9"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Subsequencia"
            										DisplayMemberPath="NumeroOrdemSequencia"
            										Title="Bovespa.Ordens.Label.Subsequencia"
            										MaxLength="5"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Cliente"
            										DisplayMemberPath="ApelidoCliente"
            										Title="Bovespa.Ordens.Label.Cliente"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Broker"
            										DisplayMemberPath="ApelidoBroker"
            										Title="Bovespa.Ordens.Label.Broker"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
            										DisplayMemberPath="Titulo"
            										Title="Bovespa.Ordens.Label.Ativo"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
            										DisplayMemberPath="Quantidade"
            										Title="Bovespa.Ordens.Label.Quantidade"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
            										DisplayMemberPath="QuantidadeCasada"
            										Title="Bovespa.Ordens.Label.QuantidadeCasada"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>

                                        <Grid HorizontalAlignment="Left" 
								 		  VerticalAlignment="Top" 
                                          Name="lblMensagem2"
										  Grid.Row="1" 
										  Margin="0,4,0,0" 
										  Visibility="Collapsed">
                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" 
												 StrokeThickness="0" 
												 Width="15" 
												 Margin="0,4,0,0" 
												 HorizontalAlignment="Left" 
												 VerticalAlignment="Top" 
												 Height="15"/>
                                            <Controls:SinacorLabel HorizontalAlignment="Left" 
															   Content="{DynamicResource Bovespa.Ordens.Label.OrdensNaoCasadasNaoCompoem}" 
															   Margin="19,0,0,0" 
															   HorizontalContentAlignment="Left" 
															   Width="415"/>
                                        </Grid>

                                        </Controls:SinacorExpanderContainer>

                                        <Controls:SinacorDataGrid x:Name="precoMedioNaoDiscricionariasDataGrid" 
            								ItemsSource="{Binding Path=PrecoMedioNaoDiscricionariasModelCollection}" 
            								Grid.Row="0" Grid.Column="1" Margin="0,0,0,0"
                                            Height="Auto" Width="240" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="NomeLote"
            										Width="90"                                             
            										DisplayMemberPath="NomeLote"
            										Title="Bovespa.Ordens.Label.NomeLote"
            										MaxLength="60"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="PrecoMedio"
            										Width="90"                                             
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>
                                    </Grid>
                                </Controls:SinacorExpander>
                            </Controls:SinacorExpanderContainer>
                        </Controls:SinacorTabItem>
                        <!-- TAB 2-->
                        
                        <!-- TAB 3-->
                        <Controls:SinacorTabItem  x:Name="tabTodas"  Header="{DynamicResource Bovespa.Ordens.Label.Todas}" TabIndex="14">
                            <Controls:SinacorExpanderContainer x:Name="distribuicaoOrdensLotesExpanderContainer4">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="2*"/>
                                    <RowDefinition Height="1*"/>
                                </Grid.RowDefinitions>

                                <Controls:SinacorExpander 
            						x:Name="lotesExpander2"                
            						Header="{DynamicResource Bovespa.Ordens.Label.Lotes}"
            						Grid.Row="0" Grid.Column="0" IsExpanded="True" Margin="0,-2,0,0"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>

                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="25"/>
                                        </Grid.RowDefinitions>
                                        <Controls:SinacorDataGrid 
            								x:Name="lotesDataGridTodas" Grid.Row="0"
            								ItemsSource="{Binding Path=LotesTodasModelCollection}"
                                            ConfirmSelection="lotesDataGrid_ConfirmSelection"
            								SelectionChanged="lotesDataGrid_SelectionChanged"
            								BufferedSelectionChanged="lotesDataGrid_BufferedSelectionChanged"
            								ApplyingStyle="lotesDataGridTodas_ApplyingStyle"
                                            Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            >
                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate>
                                                    <StackPanel >
                                                        <!--<Controls:SinacorContextMenuItem x:Name="ctxMnuDistribuir" Header="{DynamicResource Bovespa.Ordens.Label.Distribuir}" Click="ctxMnuDistribuir_Click" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}, Path=ModulePlusLicense}" />-->
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuDistribuir" Header="{DynamicResource Bovespa.Ordens.Label.Distribuir}" Click="ctxMnuDistribuir_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.DistribuicaoValida, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                        <Controls:SinacorContextMenuItem x:Name="ctxMnuCancelar" Header="{DynamicResource Bovespa.Ordens.Label.MenuContextoCancelmentoDistribuicao}" Click="ctxMnuCancelar_Click" IsEnabled="{Binding Path=Presenter.DistribuicaoControles.CancelamentoValido, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>

                                                <Controls:Column Name="ApelidoCliente"
		                                            DisplayMemberPath="ApelidoCliente"
		                                            Title="Bovespa.Ordens.Label.Cliente"
		                                            MaxLength="18"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
		                                            DisplayMemberPath="Titulo"
		                                            Title="Bovespa.Ordens.Label.Ativo"
		                                            MaxLength="12"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="NaturezaOperacao"
		                                            DisplayMemberPath="NaturezaOperacao"
		                                            Title="Bovespa.Ordens.Label.NaturezaOperacao"
		                                            MaxLength="1"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
		                                            DisplayMemberPath="NumeroOrdem"
		                                            Title="Bovespa.Ordens.Label.NumeroNegocio"
		                                            MaxLength="9"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"           
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="LoginOperador"
		                                            DisplayMemberPath="LoginOperador"
		                                            Title="Bovespa.Ordens.Label.Operador"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"  
		                                            HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
		                                            DisplayMemberPath="Quantidade"
		                                            Title="Bovespa.Ordens.Label.Quantidade"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            StringFormat="n4"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
		                                            DisplayMemberPath="QuantidadeCasada"
		                                            Title="Bovespa.Ordens.Label.QuantidadeCasada"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n4" 
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
		                                            DisplayMemberPath="PrecoMedio"
		                                            Title="Bovespa.Ordens.Label.PrecoMedio"
		                                            MaxLength="18"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n6"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="NumeroConjunto"
		                                            DisplayMemberPath="NumeroConjunto"
		                                            Title="Bovespa.Ordens.Label.NumeroConjunto"
		                                            MaxLength="9"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeDigitada"
		                                            DisplayMemberPath="QuantidadeDigitada"
		                                            Title="Bovespa.Ordens.Label.QuantidadeDigitada"
		                                            MaxLength="20"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n4"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PercentualDigitado"
		                                            DisplayMemberPath="PercentualDigitado"
		                                            Title="Bovespa.Ordens.Label.PercentualDigitado"
		                                            MaxLength="6"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n2"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrazoTermo"
		                                            DisplayMemberPath="PrazoTermo"
		                                            Title="Bovespa.Ordens.Label.PrazoTermo"
		                                            MaxLength="6"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            StringFormat="n0"
		                                            HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Discricionaria"
		                                            DisplayMemberPath="Discricionaria"
		                                            Title="Bovespa.Ordens.Label.Discricionaria"
		                                            MaxLength="1"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False"
		                                            HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="Bolsa"
		                                            DisplayMemberPath="Bolsa"
		                                            Title="Bovespa.Ordens.Label.Bolsa"
		                                            MaxLength="2"
		                                            IsRequired="True"
		                                            AllowInsert="False"
		                                            AllowUpdate="False" 
		                                            HorizontalCellAlignment="Center" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>

                                        <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Left" Margin="0,4,0,0">
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Clientes.Label.Legenda}" x:Name="txtLegendaInformar2" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.NaoDistribuida}" x:Name="txtTrocarDepois2" Width="96" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness04}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Parcialmente}" x:Name="txtPosicaoComCustodia2" Width="142" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>

                                            <Ellipse Fill="{DynamicResource BrushGridRowBusiness02}" StrokeThickness="0" Width="15" Height="15" Margin="0,0,0,0"/>
                                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Totalmente}" x:Name="txtPosicaoExCustodia2" Width="71" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Left" Margin="0,0,0,0"/>
                                        </StackPanel>
                                    </Grid>
                                </Controls:SinacorExpander>


                                <Controls:SinacorExpander 
            						x:Name="ordensExpanderTodas" 
            						Header="{DynamicResource Bovespa.Ordens.Label.Ordens}"
            						Grid.Row="1" Grid.Column="0" Margin="0,4,0,0" IsExpanded="True"
                                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"  />
                                            <!---725-->
                                            <ColumnDefinition Width="250"  />
                                            <!---240-->
                                        </Grid.ColumnDefinitions>
                                        
                                        <Controls:SinacorExpanderContainer Grid.Column="0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition	Height="*"/>
                                                <RowDefinition	Height="Auto"/>
                                            </Grid.RowDefinitions>

                                        <Controls:SinacorDataGrid  
            								x:Name="ordensTodasDataGrid"  Grid.Row="0" Grid.Column="0"
            								ItemsSource="{Binding Path=OrdensTodasModelCollection}"                                
            								SelectionChanged="ordensDataGrid_SelectionChanged"
            								ApplyingStyle="ordensDataGrid_ApplyingStyle"
                                            Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <Controls:SinacorDataGrid.ContextMenuTemplate>
                                                <DataTemplate x:Name="menuDataTemplate2">
                                                    <StackPanel>
                                                        <Controls:SinacorContextMenuItem 
            												x:Name="trocarLoteMenuItem" 
            												IsEnabled="False"
            												Header="{DynamicResource Bovespa.Ordens.Label.TrocarLote}" 
            												Click="trocarLoteMenuItem_Click"
            												Loaded="trocarLoteMenuItem_Loaded"
            												IsVisibleChanged="trocarLoteMenuItem_IsVisibleChanged" />

                                                        <Controls:SinacorContextMenuItem 
            												x:Name="criarLoteMenuItem" 
            												Header="{DynamicResource Bovespa.Ordens.Label.CriarNovoLote}"
            												Click="criarLoteMenuItem_Click"
            												Loaded="criarLoteMenuItem_Loaded"
            												IsVisibleChanged="criarLoteMenuItem_IsVisibleChanged" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorDataGrid.ContextMenuTemplate>

                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="Data"
            										DisplayMemberPath="DataOrdem"
            										Title="Bovespa.Ordens.Label.Data"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Center" />

                                                <Controls:Column Name="LoginOperador"
            										DisplayMemberPath="LoginOperador"
            										Title="Bovespa.Ordens.Label.Operador"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Numero"
            										DisplayMemberPath="NumeroOrdem"
            										Title="Bovespa.Ordens.Label.NumeroNegocio"
            										MaxLength="9"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n0"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Subsequencia"
            										DisplayMemberPath="NumeroOrdemSequencia"
            										Title="Bovespa.Ordens.Label.Subsequencia"
            										MaxLength="5"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="Cliente"
            										DisplayMemberPath="ApelidoCliente"
            										Title="Bovespa.Ordens.Label.Cliente"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Broker"
            										DisplayMemberPath="ApelidoBroker"
            										Title="Bovespa.Ordens.Label.Broker"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Ativo"
            										DisplayMemberPath="Titulo"
            										Title="Bovespa.Ordens.Label.Ativo"
            										MaxLength="12"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="Quantidade"
            										DisplayMemberPath="Quantidade"
            										Title="Bovespa.Ordens.Label.Quantidade"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4"
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="QuantidadeCasada"
            										DisplayMemberPath="QuantidadeCasada"
            										Title="Bovespa.Ordens.Label.QuantidadeCasada"
            										MaxLength="20"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n4" 
            										HorizontalCellAlignment="Right" />

                                                <Controls:Column Name="PrecoMedio"
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>

                                            <Grid HorizontalAlignment="Left" 
									 		  VerticalAlignment="Top" 
                                              Name="lblMensagem3"
											  Grid.Row="1" 
											  Margin="0,4,0,0" 
											  Visibility="Collapsed">
                                                <Ellipse Fill="{DynamicResource BrushGridRowBusiness06}" 
													 StrokeThickness="0" 
													 Width="15" 
													 Margin="0,4,0,0" 
													 HorizontalAlignment="Left" 
													 VerticalAlignment="Top" 
													 Height="15"/>
                                                <Controls:SinacorLabel HorizontalAlignment="Left" 
																   Content="{DynamicResource Bovespa.Ordens.Label.OrdensNaoCasadasNaoCompoem}" 
																   Margin="19,0,0,0" 
																   HorizontalContentAlignment="Left" 
																   Width="415"/>
                                            </Grid>

                                        </Controls:SinacorExpanderContainer>

                                        <Controls:SinacorDataGrid x:Name="precoMedioTodasDataGrid" 
            								ItemsSource="{Binding Path=PrecoMedioTodasModelCollection}" 
            								Grid.Row="0" Grid.Column="1" Margin="0,0,0,0"
                                            Height="Auto" Width="240" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            >
                                            <Controls:SinacorDataGrid.Columns>
                                                <Controls:Column Name="NomeLote"
            										Width="90"                                             
            										DisplayMemberPath="NomeLote"
            										Title="Bovespa.Ordens.Label.NomeLote"
            										MaxLength="60"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False" 
            										HorizontalCellAlignment="Left" />

                                                <Controls:Column Name="PrecoMedio"
            										Width="90"                                             
            										DisplayMemberPath="PrecoMedio"
            										Title="Bovespa.Ordens.Label.PrecoMedio"
            										MaxLength="18"
            										IsRequired="True"
            										AllowInsert="False"
            										AllowUpdate="False"
            										StringFormat="n6"
            										HorizontalCellAlignment="Right" />
                                            </Controls:SinacorDataGrid.Columns>
                                        </Controls:SinacorDataGrid>
                                    </Grid>
                                </Controls:SinacorExpander>
                            </Controls:SinacorExpanderContainer>
                        </Controls:SinacorTabItem>
                        <!-- TAB 3-->
                        
                    </Controls:SinacorTabControl>
                    <Controls:SinacorCheckBox x:Name="chkAtualizarGradeLotes" Content="{DynamicResource Bovespa.Ordens.Label.AtualizarGradeLotes}" Width="170" VerticalAlignment="Top" Visibility="Visible" Margin="0,-2,0,0" TabIndex="15" Grid.Row="1"/>
                </Grid>
            </Controls:SinacorExpander>
        </Controls:SinacorExpanderContainer>
    </Grid>
</Controls:SinacorWindow>

